import http from '../index'

// 获取文件列表
export const _getFileList = () => {
  return http({
    url: `/file-server/v1/upload-list`,
    method: 'get',
  })
}

/**
 * 查询文件上传的路径
 * @param
 * @returns
 */
export const _sendUploadUrl = (params) => {
  return http({
    url: `/file-server/v1/upload-folder`,
    method: 'get',
    data: params,
  })
}

/**
 * 设置文件上传的路径
 * @param
 * @returns
 */
export const _setUploadUrl = (params) => {
  return http({
    url: `/file-server/v1/upload-folder`,
    method: 'put',
    data: params,
  })
}

/**
 * 上传文件到服务器端
 * @param {params} 传入要上传的fromData
 */ 3

export const _uploadFile = (params) => {
  return http({
    url: `/file-server/v1/upload`,
    method: 'post',
    data: params,
  })
}

/**
 * 删除文件
 * @id 文件id
 * @returns
 */
export const _deleteFile = (id) => {
  return http({
    url: `/file-server/v1/upload-list/${id}`,
    method: 'delete',
  })
}

// 打包配置文件
export const _buildPack = (name) => {
  return http({
    url: `master/static/${name}`,
    method: 'get',
  })
}
